package com.yeyks.app.controller.base.vip;


import cn.hutool.extra.servlet.ServletUtil;
import com.yeyks.common.ajax.AjaxResponseBody;
import com.yeyks.commonReference.service.vip.MemberCardEnableRecordService;
import com.yeyks.vip.param.MemberCardEnableRecordCreateOrderPayRecordParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * <p>
 * 会员卡购买订单支付记录表 前端控制器
 * </p>
 *
 * @author yun
 * @since 2019-08-07
 */
@Api(tags = "会员卡购买订单支付记录", description = "会员卡购买订单支付记录")
@RestController
@RequestMapping("/vip/memberCardEnableRecord")
public class MemberCardEnableRecordController {

    @Autowired
    private MemberCardEnableRecordService memberCardEnableRecordService;

    /**
     * v3.6
     */
    @ApiOperation(value = "根据订单生成支付:v3.6")
    @RequestMapping(value = "/createOrderPayRecord", method = RequestMethod.POST)
    public AjaxResponseBody<Map<String, Object>> createOrderPayRecord(HttpServletRequest request, @Validated MemberCardEnableRecordCreateOrderPayRecordParam param) {
        param.setIp(ServletUtil.getClientIP(request));
        Map<String, Object> map = memberCardEnableRecordService.createOrderPayRecord(param);
        return AjaxResponseBody.success(map);
    }

}
